<?php
/*
 * Copyright (c) 2011 Todd Brady
 *
 * PS3Theatre is freely distributable under the terms of the MIT license.
 * For details, see the MIT-Liscence web site: http://www.opensource.org/licenses/mit-license.php 
 */
 
	include("includes/db_connect.php");
	$typeString = "Music";
	$directoriesResult=mysql_query("SELECT d.id, d.computer_path, d.http_path FROM tbl_directories d, tbl_types t WHERE d.type_id=t.id AND t.type = '$typeString' ORDER BY computer_path");
	$fileExtsResult=mysql_query("SELECT f.id, f.extension, f.is_active FROM tbl_fileextensions f, tbl_types t WHERE f.type_id=t.id AND t.type='$typeString' ORDER BY is_active desc,extension");
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>
<LINK href="../css/main.css" rel="stylesheet" type="text/css">
</head>
<body>
<h4>Main</h4>
Theme
<h4>Directories</h4>
<table width="70%" border="0" align="center" cellpadding="0" cellspacing="0" class="setupTable">
  <tr>
    <th width="8%">&nbsp;</th>
    <th width="8%">&nbsp;</th>
    <th width="42%">Computer Path</th>
    <th width="42%">HTTP Path</th>
  </tr>
   <?php
  $i=0;
	while ($row = mysql_fetch_array($directoriesResult)) {
	$i++;
	$class = "";
	
	if($i % 2 == 0){
		$class = 'class="alt"';
	}
  ?>
  <tr>
	<td <?php echo $class;?>><div align="center"><a href="a">Edit</a></div></td>
  	<td <?php echo $class;?>><div align="center"><a href="a">Delete</a></div></td>
	<td <?php echo $class;?>><?php echo $row['computer_path'];?></td>
	<td <?php echo $class;?>><?php echo $row['http_path'];?></td>
  </tr>
  <?php 
  	}
	
	if(mysql_num_rows($directoriesResult) == 0){
  ?>
  <tr>
    <td colspan="4"><div align="center">No directories set</div></td>
  </tr>
  <?php
  }
  ?>
</table>

<h4>File Extensions</h4>
<table width="50%" border="0" align="center" cellpadding="0" cellspacing="0" class="setupTable">
  <tr>
    <th width="8%">&nbsp;</th>
    <th width="8%">&nbsp;</th>
    <th width="42%">Extension</th>
    <th width="42%">Is Active</th>
  </tr>
	<?php
  $i=0;
	while ($row = mysql_fetch_array($fileExtsResult)) {
	$i++;
	$class = "";
	
	if($i % 2 == 0){
		$class = 'class="alt"';
	}
  ?>
  <tr>
	<td <?php echo $class;?>><div align="center"><a href="a">Edit</a></div></td>
  	<td <?php echo $class;?>><div align="center"><a href="a">Delete</a></div></td>
	<td <?php echo $class;?>><?php echo $row['extension'];?></td>
	<td <?php echo $class;?>><?php echo $row['is_active'];?></td>
  </tr>
   <?php 
  	}
	
	if(mysql_num_rows($fileExtsResult) == 0){
  ?>
   <tr>
    <td colspan="4"><div align="center">No file extensions set</div></td>
  </tr>
  <?php
  }
  ?>
</table>
</body>
</html>
